HTML Forms :
THE FORM TAG








When a form is submitted, all fields on the form are being sent.

The <form> tag tells the browser where the form starts and ends. You can add all kinds of HTML tags between the <form> and </form> tags.

This means that a form can easily include a table or an image along with the form fields mentioned on the next page.

Look at this example:

<html>
<head>
<title>My Page</title>
</head>

<body>
<!-- Here goes HTML -->
<form>
<!-- Here goes form fields and HTML -->
</form>
<!-- Here goes HTML -->
</body>
</html>


Note:
Unlike a table, forms are not visible on the page.


The form in our example is useless for two obvious reasons:
  • First it contains no form fields. It is simply comparable to a blank sheet of paper.


  • Second, it does not contain a recipient for the form once it is submitted.





To let the browser know where to send the content we add these properties to the <form> tag:
  • action=address


  • method=post or method=get


The address is the url of the cgi script the content should be sent to. The post and get methods are simply two different methods for submitting data to the script.

If you are using a pre-programmed script (which we assume here) it is not important to understand the difference between get and post.

In the description of the script you are using it will be made clear whether the scripts should be addressed using one method or the other.

Below is an example of a typical form tag, with both action and method specified.

<html>
<head>
<title>My Page</title>
</head>

<body>
<!-- Here goes HTML -->
<form method="post" action="http://www.echoecho.com/cgi-bin/formmail.cgi">
<!-- Here goes form fields and HTML -->
</form>
<!-- Here goes HTML -->
</body>
</html>






All we need now, is to allow the visitor to enter some information.

The next page explains how to do that....

 << PREVIOUS
READ MORE >>  
















DEVELOPER TIP!





     "Better Than Books - As Easy As It Gets!"